package com.sky.controller.user;

import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.UserSetmealService;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zcf
 */
@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
@Api(tags = "用户端套餐接口")
public class SetmealController {


    @Resource
    private UserSetmealService userSetmealService;

    /**
     * 根据分类id查询套餐
     *
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("根据分类id查询套餐")
    public Result<List<Setmeal>> list(Long categoryId) {
        List<Setmeal> list = userSetmealService.list(categoryId);
        return Result.success(list);
    }

    /**
     * 根据套餐id查询包含的菜品
     *路径参数
     */
    @GetMapping("/dish/{id}")
    @ApiOperation("根据套餐id查询包含的菜品")
    public Result<List<DishItemVO>> dish(@PathVariable Long id) {
     List<DishItemVO> list = userSetmealService.dish(id);
        return Result.success(list);
    }

}
